package com.gaga.console.core.controller.account;


import com.gaga.common.path.ApiPath;
import com.gaga.common.result.Result;
import com.gaga.console.base.controller.BaseController;
import com.gaga.console.core.entity.vo.AccountAnalysisSumByCategoryVo;
import com.gaga.console.core.entity.vo.AccountAnalysisSumVo;
import com.gaga.console.core.service.AccountAnalysisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author liujia
 * @since 2023-12-06
 */
@Api(tags = "账户管理-分析")
@RestController
@RequestMapping(ApiPath.ROOT + "/account/analysis")
public class AccountAnalysisController extends BaseController {
    @Autowired
    private AccountAnalysisService accountAnalysisService;

    /**
     * 汇总分析
     */
    @ApiOperation(value = "汇总分析")
    @PostMapping("/sumAnalysis")
    public Result sumAnalysis(@Validated @RequestBody AccountAnalysisSumVo entity) {
        return Result.ok(accountAnalysisService.sumAnalysis(entity));
    }

    /**
     * 按照分类来汇总数据信息
     */
    @ApiOperation(value = "按照分类来汇总数据信息")
    @PostMapping("/sumAnalysisByCategory")
    public Result sumAnalysisByCategory(@Validated @RequestBody AccountAnalysisSumByCategoryVo entity) {
        return Result.ok(accountAnalysisService.sumAnalysisByCategory(entity));
    }
}
